<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="wrap"></div>
		<button onclick="resert">resert</button>
		<script>
			function resert() {
				const xhr = new XMLHttpRequest();
				xhr.open("POST", 'send-ajax-data2.php', true);

				//随请求一起发送正确的标头信息
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

				xhr.onreadystatechange = () => { // 在状态更改时调用函数.
					if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
						// 请求已完成。在这里进行处理.
						document.getElementById('wrap').innerText = xhr.responseText
					}
				}
				xhr.send("foo=bar&lorem=ipsum");
				// xhr.send(new Int8Array());
				// xhr.send(document);
			}
		</script>
	</body>
</html>
